package li.com.springaidemo.end;

import li.com.springaidemo.pojo.Cron;
import li.com.springaidemo.service.CronService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Component;

@Component
public class End implements ApplicationListener<ContextClosedEvent> {

    @Autowired
    private CronService cronService;
    @Override
    public void onApplicationEvent(ContextClosedEvent event) {
        Cron cron=new Cron(0,"0","0","0","0");
        cronService.updateById(cron);
    }
}
